<?php

require_once('Zend/Controller/Plugin/Abstract.php');

/**
 * Plugin d'initialisation
 * 
 * @uses Zend_Controller_Plugin_Abstract
 */
class Myzen_Controller_Plugin_Layout extends Zend_Controller_Plugin_Abstract
{
	
  public function routeShutdown(Zend_Controller_Request_Abstract $request) {
		Zend_Layout::startMvc(array('layoutPath' => ROOT_PATH.'/app/src/layouts','layout' =>'default'));
		$view = Zend_Layout::getMvcInstance()->getView();
		$view->setEncoding('UTF-8');
		$view->doctype('XHTML1_TRANSITIONAL');
		$view->headMeta()->appendHttpEquiv('Content-Type','text/html; charset=UTF-8');
		$view->setHelperPath('Myzen/View/Helper', 'Myzen_View_Helper');
		$view->headLink()->appendStylesheet($view->baseUrl().'/ressources/style/default/style.css');
		//$view->headScript()->appendFile($view->ressourcesBaseUrl().'/javascript/yui/build/yuiloader/yuiloader-min.js', 'text/javascript');
		//$view->headScript()->appendFile('http://yui.yahooapis.com/2.8.0/build/yuiloader/yuiloader-min.js', 'text/javascript');
		
		//hide the sidebar
		$view->YUILoader()->load(array('connection','yahoo','event'));
		
		$view->headScript()->appendFile($view->baseUrl().'/ressources/index/javascript/toggleSideBar.js', 'text/javascript');
		$view->javascriptData('dt_toggleSideBarBaseURL',$view->baseUrl().'/index/index/togglesidebar/format/json/');
		
		unset($view);
	}
	
} //end class